package com.dxy.chatserver.config;

import com.mongodb.client.MongoClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * 聊天模块mongo数据配置
 *
 * @author: none
 * @date: 2022/1/8
 **/
@Configuration
@EnableConfigurationProperties({ChatMsgMongoConfig.class})
public class ChatMsgMongoConfiguration {

    @Resource
    private ChatMsgMongoConfig config;

    @Bean("chatMsgMongoClient")
    public MongoClient mongoClient() {
        return MongoBuilder.client(config.getUri());
    }

}
